package com.gitee.melin.bee.core.jdbc.parser;

import java.util.Objects;

public class InetPeer {
    String host;

    Integer port;

    public InetPeer(String host, Integer port) {
        this.host = host;
        this.port = port;
    }

    public InetPeer(String host) {
        this.host = host;
    }

    public String getHost() {
        return host;
    }

    public Integer getPort() {
        return port;
    }

    @Override
    public String toString() {
        return host + ":" + port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        InetPeer inetPeer = (InetPeer) o;
        return Objects.equals(host, inetPeer.host) && Objects.equals(port, inetPeer.port);
    }

    @Override
    public int hashCode() {
        return Objects.hash(host, port);
    }
}
